#ifndef _RM_
#define _RM_

#include <iostream>
#include <list>

#include "Renderable.h"
#include "GraphicsManager.h"
#include "ObjectManager.h"
//#include "tank.h"



class RenderingManager
{
private:
	GraphicsManager* gm;
	ObjectManager* om;

public:
	RenderingManager(GraphicsManager* _gm=NULL, ObjectManager* _om=NULL) { gm = _gm; om = _om; }
	~RenderingManager() {};

	void Render()
	{
		if((gm != NULL) && (om != NULL))
		{
			Entity* item = NULL;
			int i=1;
			do 
			{
				item = om->GetItem(i);
				if(item)
				{
					switch(item->GetType())
					{
					case TYPE_TURRET:
					case TYPE_TANK:
						gm->BlitSprite(item->GetSprite());
						break;
					default:
						break;
					}
				}
				++i;

			} while (item != NULL);

			/*
			for(std::list<Renderable*>::iterator it = items->begin(); it != items->end(); ++it)
			{
				Sprite* tmpSprite = (*it).GetSprite();
				gm->BlitSurface(tmpSprite->GetSurface(), (*)(tmpSprite->GetDestRect()));				

			}
			*/
		}

	}
};

#endif